clear all;

load('synthetic_control.mat');

alpha_n3=mean([y_treat92(:,2);y_treat94(:,2);y_treat94(:,3);y_treat96(:,2);y_treat96(:,3);y_treat96(:,4)]-[y_SC92(:,2);y_SC94(:,2);y_SC94(:,3);y_SC96(:,2);y_SC96(:,3);y_SC96(:,4)]);
alpha_n2=mean([y_treat90(:,2);y_treat92(:,3);y_treat94(:,4);y_treat96(:,5)]-[y_SC90(:,2);y_SC92(:,3);y_SC94(:,4);y_SC96(:,5)]);
alpha_n1=mean([y_treat88(:,2);y_treat90(:,3);y_treat92(:,4);y_treat94(:,5);y_treat96(:,6)]-[y_SC88(:,2);y_SC90(:,3);y_SC92(:,4);y_SC94(:,5);y_SC96(:,6)]);
alpha_0=mean([y_treat88(:,3);y_treat90(:,4);y_treat92(:,5);y_treat94(:,6);y_treat96(:,7)]-[y_SC88(:,3);y_SC90(:,4);y_SC92(:,5);y_SC94(:,6);y_SC96(:,7)]);
alpha_1=mean([y_treat88(:,4);y_treat90(:,5);y_treat92(:,6);y_treat94(:,7)]-[y_SC88(:,4);y_SC90(:,5);y_SC92(:,6);y_SC94(:,7)]);
alpha_2=mean([y_treat88(:,5);y_treat88(:,6);y_treat88(:,7);y_treat90(:,6);y_treat90(:,7);y_treat92(:,7)]-[y_SC88(:,5);y_SC88(:,6);y_SC88(:,7);y_SC90(:,6);y_SC90(:,7);y_SC92(:,7)]);

ate=[alpha_n3,alpha_n2,alpha_n1,alpha_0,alpha_1,alpha_2];

nnewbranch=length(y_treat88)+length(y_treat90)+length(y_treat92)+length(y_treat94)+length(y_treat96);
nobs=2 * nnewbranch * 6; % 2 because we have both treatment market and synthetic control market, 6 because we use 6 years' data, from 86 to 96
